/**
 * Created by WLG on 2018/11/12.
 */
const mongoose = require('mongoose');
const redisDB = require('../lib/redisManage');
let serverConfig = require('../config/serverConfig');
let CryptoUtil = require('../lib/cryptoUtil.js');
let Chat = mongoose.model('Chat');
let CommonUtil = require('../lib/commonUtil');
/**
 *
 */
class ThirdApiService{
    static async getImInitModeCache(imToken){
        return await redisDB.get(this.createImInitModeKey(imToken));
    }
    static async setImInitModeCache(key,shareMsg){
        await redisDB.set(this.createImInitModeKey(key),shareMsg,serverConfig.shareMsgCacheTime)
    }
    static createImInitModeKey(imToken){
        return 'ShareMsg:'+ imToken;
    }
    static createImToken(){
        return CommonUtil.createUUID();
    }
}

module.exports = ThirdApiService;